package com.hl.hospital.controller;

import com.hl.hospital.config.Constants;
import com.hl.hospital.dao.*;
import com.hl.hospital.entity.*;
import com.hl.hospital.service.impl.EmrServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpServlet;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: hl
 * @Date: 2021/06/22/17:44
 */
@Controller
public class EmrController extends HttpServlet {
    @Autowired
    private EmrServiceImpl emrService;
    @Autowired
    private EmrLisresultMapper emrLisresultMapper;
    @Autowired
    private EmrDeptVsWardMapper emrDeptVsWardMapper;
    @Autowired
    private EmrDoctorInfoMapper emrDoctorInfoMapper;
    @Autowired
    private EmrEmpDeptMapper emrEmpDeptMapper;
    @Autowired
    private EmrGetpatientconditionMapper emrGetpatientconditionMapper;
    @Autowired
    private EmrInpatientMapper emrInpatientMapper;
    @Autowired
    private EmrOutpatientPatientMapper emrOutpatientPatientMapper;
    @Autowired
    private EmrPatientinfoMapper emrPatientinfoMapper;
    @Autowired
    private EmrPrescriptionMapper emrPrescriptionMapper;
    @Autowired
    private EmrPrescriptionAllMapper emrPrescriptionAllMapper;
    @Autowired
    private EmrPrescriptionListMapper emrPrescriptionListMapper;
    @Autowired
    private EmrOutpatientPatientThxMapper emrOutpatientPatientThxMapper;
    @Autowired
    private EmrPatientBabyMapper emrPatientBabyMapper;
    @Autowired
    private EmrTransferDeptMapper emrTransferDeptMapper;
    @Autowired
    private EmrPrescriptionListAllMapper emrPrescriptionListAllMapper;
    @Autowired
    private EmrOutpatientPatientJcMapper emrOutpatientPatientJcMapper;
    @Autowired
    private EmrPatientPropertyMapper emrPatientPropertyMapper;

    private List<EmrDictUse> emrDictUses;

    @RequestMapping(value = "emrdictuse",method = RequestMethod.GET)
    public String emrDictUse(Model model)
    {
        emrDictUses = emrService.selectAll();
        model.addAttribute(Constants.EMRDICTUSE,emrDictUses);
        return "emrdictuse";
    }

    @RequestMapping(value = "emrdeptvsward",method = RequestMethod.GET)
    public String EmrDeptVsWard(Model model)
    {
        List<EmrDeptVsWard> emrDeptVsWards = emrDeptVsWardMapper.selectAll();
        model.addAttribute(Constants.EMRDEPTVSWARD,emrDeptVsWards);
        return "emrdeptvsward";
    }

    @RequestMapping(value = "emrdoctorinfo",method = RequestMethod.GET)
    public String emrdoctorinfo(Model model)
    {
        List<EmrDoctorInfo> emrDoctorInfos = emrDoctorInfoMapper.selectAll();
        model.addAttribute(Constants.EMRDOCTORINFO,emrDoctorInfos);
        return "emrdoctorinfo";
    }

    @RequestMapping(value = "emrempdept",method = RequestMethod.GET)
    public String emrempdept(Model model)
    {
        List<EmrEmpDept> emrEmpDepts = emrEmpDeptMapper.selectAll();
        model.addAttribute(Constants.EMREMPDEPT,emrEmpDepts);
        return "emrempdept";
    }

    @RequestMapping(value = "emrgetpatientcondition",method = RequestMethod.GET)
    public String emrgetpatientcondition(Model model)
    {
        List<EmrGetpatientcondition> emrGetpatientconditions = emrGetpatientconditionMapper.selectAll();
        model.addAttribute(Constants.EMRGETPATIENTCONDITION,emrGetpatientconditions);
        return "emrgetpatientcondition";
    }

    @RequestMapping(value = "emrinpatient",method = RequestMethod.GET)
    public String emrinpatient(Model model)
    {
        List<EmrInpatient> emrInpatients = emrInpatientMapper.selectAll();
        model.addAttribute(Constants.EMRINPATIENT,emrInpatients);
        return "emrinpatient";
    }

    @RequestMapping(value = "emroutpatientpatient",method = RequestMethod.GET)
    public String emroutpatientpatient(Model model)
    {
        List<EmrOutpatientPatient> emrOutpatientPatients = emrOutpatientPatientMapper.selectAll();
        model.addAttribute(Constants.EMROUTPATIENTPATIENT,emrOutpatientPatients);
        return "emroutpatientpatient";
    }
    @RequestMapping(value = "emrlisresult",method = RequestMethod.GET)
    public String emrlisresult(Model model)
    {
        List<EmrLisresult>  emrLisresults= emrLisresultMapper.selectAll();
        model.addAttribute(Constants.EMRLISRESULT,emrLisresults);
        return "emrlisresult";
    }
    @RequestMapping(value = "emrpatientinfo",method = RequestMethod.GET)
    public String emrPatientinfo(Model model)
    {
        List<EmrPatientinfo> emrPatientinfos = emrPatientinfoMapper.selectAll();
        model.addAttribute(Constants.EMRPATIENTINFO,emrPatientinfos);
        return "emrpatientinfo";
    }
    @RequestMapping(value = "emrprescription",method = RequestMethod.GET)
    public String emrPrescription(Model model)
    {
        List<EmrPrescription> emrPrescriptions = emrPrescriptionMapper.selectAll();
        model.addAttribute(Constants.EMRPRESCRIPTION,emrPrescriptions);
        return "emrprescription";
    }
    @RequestMapping(value = "emrprescriptionall",method = RequestMethod.GET)
    public String emrPrescriptionall(Model model)
    {
        List<EmrPrescriptionAll> emrPrescriptionAlls = emrPrescriptionAllMapper.selectAll();
        model.addAttribute(Constants.EMRPRESCRIPTIONALL,emrPrescriptionAlls);
        return "emrprescriptionall";
    }
    @RequestMapping(value = "emrprescriptionlist",method = RequestMethod.GET)
    public String emrPrescriptionList(Model model)
    {
        List<EmrPrescriptionList> emrPrescriptionLists = emrPrescriptionListMapper.selectAll();
        model.addAttribute(Constants.EMRPRESCRIPTIONLIST,emrPrescriptionLists);
        return "emrprescriptionlist";
    }
    @RequestMapping(value = "emrprescriptionlistall",method = RequestMethod.GET)
    public String emrPrescriptionListall(Model model)
    {
        List<EmrPrescriptionListAll> emrPrescriptionListAlls = emrPrescriptionListAllMapper.selectAll();
        model.addAttribute(Constants.EMRPRESCRIPTIONLISTALL,emrPrescriptionListAlls);
        return "emrprescriptionlistall";
    }
    @RequestMapping(value = "emrtransferdept",method = RequestMethod.GET)
    public String emrTransferDept(Model model)
    {
        List<EmrTransferDept>  emrTransferDepts= emrTransferDeptMapper.selectAll();
        model.addAttribute(Constants.EMRTRANSFERDEPT,emrTransferDepts);
        return "emrtransferdept";
    }
    @RequestMapping(value = "emrpatientbaby",method = RequestMethod.GET)
    public String emrpatientbaby(Model model)
    {
        List<EmrPatientBaby> emrPatientBabies= emrPatientBabyMapper.selectAll();
        model.addAttribute(Constants.EMRPATIENTBABY,emrPatientBabies);
        return "emrpatientbaby";
    }
    @RequestMapping(value = "emroutpatientjc",method = RequestMethod.GET)
    public String emroutpatientjc(Model model)
    {
        List<EmrOutpatientPatientJc> emrOutpatientPatientJcs= emrOutpatientPatientJcMapper.selectAll();
        model.addAttribute(Constants.EMROUTPATIENTJC,emrOutpatientPatientJcs);
        return "emroutpatientjc";
    }
    @RequestMapping(value = "emroutpatientthx",method = RequestMethod.GET)
    public String emroutpatientthx(Model model)
    {
        List<EmrOutpatientPatientThx> emrOutpatientPatientThxes= emrOutpatientPatientThxMapper.selectAll();
        model.addAttribute(Constants.EMROUTPATIENTTHX,emrOutpatientPatientThxes);
        return "emroutpatientthx";
    }
    @RequestMapping(value = "emrpatientproperty",method = RequestMethod.GET)
    public String emrpatientproperty(Model model)
    {
        List<EmrPatientProperty> emrPatientProperties= emrPatientPropertyMapper.selectAll();
        model.addAttribute(Constants.EMRPATIENTPROPERTY,emrPatientProperties);
        return "emrpatientproperty";
    }

}
